package week2;

import java.util.Scanner;

public class Xiaoqiu
{
  public static void main(String[]args)
  {
    System.out.println("请输入小球下落的高度和落地的次数: ");
    Scanner scanner = new Scanner(System.in);
    float h = scanner.nextFloat();
    float n = scanner.nextFloat();
    //float h = 100,n = 3;
    float sum = h;
    h/=2;
    for(int i = 2;i <= n;i++)
    {
      sum += h*2;
      h /= 2;
    }
    System.out.println("在"+100+"米，经过"+n+"次后，能反弹："+h+"米，经过的距离："+sum);
    scanner.close();
  }
}
